package com.management.demo.dto.management;

import com.management.demo.valid.annotation.Sex;
import com.management.demo.valid.group.AddValidGroup;
import com.management.demo.valid.group.EditValidGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Data
@Schema(description = "添加/修改用户参数")
public class UserDTO {

    @NotNull(message = "id不能为空", groups = EditValidGroup.class)
    @Schema(description = "id")
    private Integer id;

    @NotBlank(message = "用户名不能为空", groups = {AddValidGroup.class, EditValidGroup.class})
    @Schema(description = "用户名")
    public String username;

    @NotBlank(message = "昵称不能为空", groups = {AddValidGroup.class, EditValidGroup.class})
    @Schema(description = "昵称")
    public String nickname;

    @NotBlank(message = "密码不能为空", groups = AddValidGroup.class)
    @Schema(description = "密码")
    private String password;

    @Schema(description = "头像")
    private String avatar;

    @Sex(groups = {AddValidGroup.class, EditValidGroup.class})
    @Schema(description = "性别")
    private Integer sex;
}
